import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '@/views/login/Index.vue'
import Layout from '@/views/layout/Index.vue'
import Home from '@/views/home/Home.vue'

const System = () => import('@/views/system/Index.vue')
const User = () => import('@/views/system/user/Index.vue')
const Role = () => import('@/views/system/role/Index.vue')
const Permission = () => import('@/views/system/permission/Index.vue')

const Gather = () => import('@/views/gather/Index.vue')
const Ongather = () => import('@/views/gather/ongather/Index.vue')
const Offgather = () => import('@/views/gather/offgather/Index.vue')
const Externaldata = () => import('@/views/gather/externaldata/Index.vue')

const Handle = () => import('@/views/handle/Index.vue')
const Examine = () => import('@/views/handle/examine/Index.vue')
const Dealwith = () => import('@/views/handle/dealwith/Index.vue')
const Manage = () => import('@/views/handle/manage/Index.vue')

const Consult = () => import('@/views/consult/Index.vue')
const Basis = () => import('@/views/consult/basis/Index.vue')
const High = () => import('@/views/consult/high/Index.vue')

const Analysis = () => import('@/views/analysis/Index.vue')
const Count = () => import('@/views/analysis/count/Index.vue')
const Space = () => import('@/views/analysis/space/Index.vue')
const Forecast = () => import('@/views/analysis/forecast/Index.vue')

const Document = () => import('@/views/document/Index.vue')
const Create = () => import('@/views/document/create/Index.vue')
const Arrive = () => import('@/views/document/arrive/Index.vue')

const Liuyan = () => import('@/views/liuyan/Index.vue')
const Fabu = () => import('@/views/liuyan/fabu/Index.vue')
const Guanli = () => import('@/views/liuyan/guanli/Index.vue')

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: Layout,
    children: [
      {
        path: '/', // 首页
        name: 'home',
        component: Home
      },
      {
        path: '/system', // 系统管理
        name: 'system',
        component: System,
        children: [
          {
            path: 'user', // 访问路径： /system/user
            name: 'user',
            component: User
          },
          {
            path: 'role', // 访问路径： /system/role
            name: 'role',
            component: Role
          },
          {
            path: 'permission', // 访问路径： /system/permission
            name: 'permission',
            component: Permission
          }
        ]
      },
      {
        path: '/gather', // 信息采集
        name: 'gather',
        component: Gather,
        children: [
          {
            path: 'ongather', // 访问路径： /gather/ongather
            name: 'ongather',
            component: Ongather
          },
          {
            path: 'offgather', // 访问路径： /gather/offgather
            name: 'offgather',
            component: Offgather
          },
          {
            path: 'externaldata', // 访问路径： /gather/externaldata
            name: 'externaldata',
            component: Externaldata
          }
        ]
      },
      {
        path: '/handle', // 信息处理
        name: 'handle',
        component: Handle,
        children: [
          {
            path: 'examine', // 访问路径： /handle/examine
            name: 'examine',
            component: Examine
          },
          {
            path: 'dealwith', // 访问路径： /handle/dealwith
            name: 'dealwith',
            component: Dealwith
          },
          {
            path: 'manage', // 访问路径： /handle/manage
            name: 'manage',
            component: Manage
          }
        ]
      },
      {
        path: '/consult', // 信息查询
        name: 'consult',
        component: Consult,
        children: [
          {
            path: 'basis', // 访问路径： /consult/basis
            name: 'basis',
            component: Basis
          },
          {
            path: 'high', // 访问路径： /consult/high
            name: 'high',
            component: High
          }
        ]
      },
      {
        path: '/analysis', // 信息分析
        name: 'analysis',
        component: Analysis,
        children: [
          {
            path: 'count', // 访问路径： /analysis/count
            name: 'count',
            component: Count
          },
          {
            path: 'space', // 访问路径： /analysis/space
            name: 'space',
            component: Space
          },
          {
            path: 'forecast', // 访问路径： /analysis/forecast
            name: 'forecast',
            component: Forecast
          }
        ]
      },
      {
        path: '/document', // 文书生成
        name: 'document',
        component: Document,
        children: [
          {
            path: 'create', // 访问路径： /document/create
            name: 'create',
            component: Create
          },
          {
            path: 'arrive', // 访问路径： /document/arrive
            name: 'arrive',
            component: Arrive
          }
        ]
      },
      {
        path: '/liuyan', // 留言
        name: 'liuyan',
        component: Liuyan,
        children: [
          {
            path: 'fabu', // 访问路径： /liuyan/fabu
            name: 'fabu',
            component: Fabu
          },
          {
            path: 'guanli', // 访问路径： /liuyan/guanli
            name: 'guanli',
            component: Guanli
          }
        ]
      }
    ]

  }, {
    path: '/login',
    name: 'login',
    component: Login
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
